#pragma GCC optimize(2)
#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
#include <bitset>
#define F first
#define S second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;

void solve()
{
	string s;
	cin>>s;
	if(s[0]=='(' && s[1]==')' && s.size()==2)
	{
		cout<<"NO"<<endl;
		return ;
	}
	cout<<"YES"<<endl;
	int f=0;
//	cout<<s.size();
	for(int i=0;i+1<s.size();i++)
	{
		if(s[i]=='(' && s[i+1]=='(')
		{
			f=1;
//			cout<<f<<endl;
			break;
		}
		else if(s[i]==')' && s[i+1]==')')
		{
			f=1;
			break;
		}
	}
	if(f)
	{
		for(int i=1;i<=s.size();i++)
		{
			cout<<"()";
		}
	}
	else
	{
		for(int i=1;i<=s.size();i++)
		{
			cout<<"(";
		}
		for(int i=1;i<=s.size();i++)
		{
			cout<<")";
		}
	}
	cout<<endl;
}
int main()
{
	IOS;
	int T=1;
	cin>>T;

	while(T--)
	{
		solve();
	}

	return 0;
}

